#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	int t;	
	cin >> t;
	while (t--) {
		string s;
		cin >> s;
		for (int i = 0; i < 3; i++) {
			if (s[i] >= 'A' && s[i] <= 'Z') {
				s[i] += 32;
			}
		}
		if (s == "yes") {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;
}